<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>DRACOExporter - Three.js Docs</title>
	<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<script src="../scripts/highlight.min.js"></script>
	<link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
	<link type="text/css" rel="stylesheet" href="../styles/page.css">
</head>
<body>
	<h1 translate="no">DRACOExporter</h1>
		<section>
			<header>
				<div class="class-description"><p>An exporter to compress geometry with the Draco library.</p>
<p><a href="https://google.github.io/draco/" target="_blank" rel="noopener">Draco</a> is an open source library for compressing and
decompressing 3D meshes and point clouds. Compressed geometry can be significantly smaller,
at the cost of additional decoding time on the client device.</p>
<p>Standalone Draco files have a <code>.drc</code> extension, and contain vertex positions,
normals, colors, and other attributes. Draco files <em>do not</em> contain materials,
textures, animation, or node hierarchies – to use these features, embed Draco geometry
inside of a glTF file. A normal glTF file can be converted to a Draco-compressed glTF file
using <a href="https://github.com/AnalyticalGraphicsInc/gltf-pipeline" target="_blank" rel="noopener">glTF-Pipeline</a>.</p></div>
				<h2>Code Example</h2>
				<div translate="no"><pre><code class="language-js">const exporter = new DRACOExporter();
const data = exporter.parse( mesh, options );
</code></pre></div>
			</header>
			<article>
				<h2 class="subsection-title">Import</h2>
				<p><span translate="no">DRACOExporter</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
				<pre><code class="language-js">import { DRACOExporter } from 'three/addons/exporters/DRACOExporter.js';</code></pre>
				<div class="container-overview">
					<h2>Constructor</h2>
					<h3 class="name name-method" id="DRACOExporter" translate="no">new <a href="#DRACOExporter">DRACOExporter</a><span class="signature">()</span> </h3>
					<div class="method">
					</div>
				</div>
				<h2 class="subsection-title">Properties</h2>
				<div class="member">
					<h3 class="name" id=".MESH_EDGEBREAKER_ENCODING" translate="no">.<a href="#.MESH_EDGEBREAKER_ENCODING">MESH_EDGEBREAKER_ENCODING</a><span class="type-signature"> : number</span> <span class="type-signature">(constant) </span></h3>
					<div class="description">
						<p>Edgebreaker encoding.</p>
						<p>Default is <code>1</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id=".MESH_SEQUENTIAL_ENCODING" translate="no">.<a href="#.MESH_SEQUENTIAL_ENCODING">MESH_SEQUENTIAL_ENCODING</a><span class="type-signature"> : number</span> <span class="type-signature">(constant) </span></h3>
					<div class="description">
						<p>Sequential encoding.</p>
						<p>Default is <code>0</code>.</p>
					</div>
				</div>
				<h2 class="subsection-title">Methods</h2>
					<h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( object : <span class="param-type"><a href="Mesh.html">Mesh</a> | <a href="Points.html">Points</a></span>, options : <span class="param-type"><a href="DRACOExporter.html#~Options">DRACOExporter~Options</a></span> )</span><span class="type-signature"> : Int8Array</span> </h3>
					<div class="method">
						<div class="description">
							<p>Parses the given mesh or point cloud and generates the Draco output.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>object</strong>
									</td>
									<td class="description last">
										<p>The mesh or point cloud to export.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>options</strong>
									</td>
									<td class="description last">
										<p>The export options.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The exported Draco.</dt>
						</dl>
					</div>
				<h2 class="subsection-title">Type Definitions</h2>
				<div class="member">
					<h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
					<div class="description">
						<p>Export options of <code>DRACOExporter</code>.</p>
					</div>
<table class="props">
	<tbody>
		<tr>
				<td class="name">
					<strong>decodeSpeed</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>Indicates how to tune the encoder regarding decode speed (0 gives better speed but worst quality).</p>
						<p>Default is <code>5</code>.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>encodeSpeed</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>Indicates how to tune the encoder parameters (0 gives better speed but worst quality).</p>
						<p>Default is <code>5</code>.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>encoderMethod</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>Either sequential (very little compression) or Edgebreaker. Edgebreaker traverses the triangles of the mesh in a deterministic, spiral-like way which provides most of the benefits of this data format.</p>
						<p>Default is <code>1</code>.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>quantization</strong>
						<br>
<span class="param-type">Array.&lt;number></span>
				</td>
			<td class="description last">
				<p>Indicates the precision of each type of data stored in the draco file in the order (POSITION, NORMAL, COLOR, TEX_COORD, GENERIC).</p>
						<p>Default is <code>[ 16, 8, 8, 8, 8 ]</code>.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>exportUvs</strong>
						<br>
<span class="param-type">boolean</span>
				</td>
			<td class="description last">
				<p>Whether to export UVs or not.</p>
						<p>Default is <code>true</code>.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>exportNormals</strong>
						<br>
<span class="param-type">boolean</span>
				</td>
			<td class="description last">
				<p>Whether to export normals or not.</p>
						<p>Default is <code>true</code>.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>exportColor</strong>
						<br>
<span class="param-type">boolean</span>
				</td>
			<td class="description last">
				<p>Whether to export colors or not.</p>
						<p>Default is <code>false</code>.</p>
			</td>
		</tr>
	</tbody>
</table>
				</div>
				<h2 class="subsection-title">Source</h2>
				<p>
					<a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/exporters/DRACOExporter.js" translate="no" target="_blank" rel="noopener">examples/jsm/exporters/DRACOExporter.js</a>
				</p>
			</article>
		</section>
<script src="../scripts/linenumber.js"></script>
<script src="../scripts/page.js"></script>
</body>
</html>